package com.aidex.system.controller;

import java.util.List;
import com.aidex.common.annotation.Log;
import com.aidex.common.core.domain.R;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.page.PageDomain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aidex.common.enums.BusinessType;
import com.aidex.common.utils.poi.ExcelUtil;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import com.aidex.common.core.controller.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import com.aidex.system.domain.VInternationalAsd;
import com.aidex.system.service.VInternationalAsdService;

/**
 * 国际申报数据Controller
 * @author wll
 * @email wll
 * @date 2021-10-14
 */
@RestController
@RequestMapping("/system/vInternationalAsd")
public class VInternationalAsdController extends BaseController
{
    @Autowired
    private VInternationalAsdService vInternationalAsdService;

    /**
     * 查询国际申报数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalAsd:list')")
    @GetMapping("/list")
    public R<PageInfo> list(VInternationalAsd vInternationalAsd, HttpServletRequest request, HttpServletResponse response)
    {
        vInternationalAsd.setPage(new PageDomain(request, response));
        return R.data(vInternationalAsdService.findPage(vInternationalAsd));
    }

    /**
     * 获取国际申报数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalAsd:query')")
    @GetMapping(value = "/{id}")
    public R<VInternationalAsd> detail(@PathVariable("id") String id)
    {
        return R.data(vInternationalAsdService.get(id));
    }

    /**
     * 新增国际申报数据
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalAsd:add')")
    @Log(title = "国际申报数据", businessType = BusinessType.INSERT)
    @PostMapping
    public R add(@RequestBody @Validated  VInternationalAsd vInternationalAsd)
    {
        return R.status(vInternationalAsdService.save(vInternationalAsd));
    }

    /**
     * 修改国际申报数据
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalAsd:edit')")
    @Log(title = "国际申报数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public R edit(@RequestBody @Validated VInternationalAsd vInternationalAsd)
    {
        return R.status(vInternationalAsdService.save(vInternationalAsd));
    }


    /**
     * 删除国际申报数据
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalAsd:remove')")
    @Log(title = "国际申报数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R remove(@PathVariable String[] ids)
    {
        return R.status(vInternationalAsdService.deleteVInternationalAsdByIds(ids));
    }


    /**
     * 导出国际申报数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalAsd:export')")
    @Log(title = "国际申报数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public R export(VInternationalAsd vInternationalAsd)
    {
        List<VInternationalAsd> list = vInternationalAsdService.findList(vInternationalAsd);
        ExcelUtil<VInternationalAsd> util = new ExcelUtil<VInternationalAsd>(VInternationalAsd.class);
        return util.exportExcel(list, "vInternationalAsd");
    }

}
